package myapps.ttclient.activity;

import myapps.ttclient.GlobalVariables;
import myapps.ttclient.R;
import myapps.ttclient.app.TTClientApplication;
import myapps.ttclient.protocol.message.SignOutRequestMessage;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class DeletePrivateDataActivity extends Activity {
	
	private TTClientApplication application;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		this.application = (TTClientApplication) this.getApplication();
		
		setContentView(R.layout.delete_private_data);
		
		Button btnDelete = (Button) this.findViewById(R.id.btnDelete);
		btnDelete.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				(new AlertDialog.Builder(DeletePrivateDataActivity.this))
				.setTitle("Confirming Dialog")
				.setMessage("Are you sure?")
				.setPositiveButton("Yes", new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {
						DeletePrivateDataActivity.this.application.removeAllConnectionSettings();
						DeletePrivateDataActivity.this.application.clearApplicationData();
						DeletePrivateDataActivity.this.application.disconnect();
					}
				})
				.setNegativeButton("No", null).show();
				
				}
		});
		
		Button btnClose = (Button) this.findViewById(R.id.btnClose);
		btnClose.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				DeletePrivateDataActivity.this.finish();
			}
		});
	}
}